//! Primitive operations like arithmetic.

/// A single-argument operation.
#[derive(Copy, Clone, Debug)]
pub enum MonOp {
    /// Integer inverse.
    Neg,

    /// Bitwise inverse.
    BNot,

    /// Logical not.
    LNot,
}

/// A two-argument operation.
#[derive(Copy, Clone, Debug)]
pub enum BinOp {
    Add,
    Sub,
    Mul,
    Eq,
    Ne,
    Shr,
    Shl,
    BAnd,
    BOr,
    Lt,
    Le,
    Gt,
    Ge,
    LOr,
    LAnd,
}

impl BinOp {
    pub fn to_operator_str(&self) -> &'static str {
        match self {
            Self::Add => "+",
            Self::Sub => "-",
            Self::Mul => "*",
            Self::Eq => "==",
            Self::Ne => "!=",
            Self::Shr => ">>",
            Self::Shl => "<<",
            Self::BAnd => "&",
            Self::BOr => "|",
            Self::Lt => "<",
            Self::Le => "<=",
            Self::Gt => ">",
            Self::Ge => ">=",

            // TODO these aren't like this in Python
            Self::LOr => "||",
            Self::LAnd => "&&",
        }
    }
}
